<?php
class Mn_master_model extends CI_Model
{

	function __construct()
	{
		parent::__construct();
		$this->load->database();
	}

	function insert($data)
	{
		$this->db->set('mn_id', $data['mn_id']);
		$this->db->set('mn_nm_vn', $data['mn_nm_vn']);
		$this->db->set('mn_nm_el', $data['mn_nm_el']);
		$this->db->set('mn_nm_jp', $data['mn_nm_jp']);
		$this->db->set('prnt_id', $data['prnt_id']);
		$this->db->set('note', $data['note']);
		$this->db->set('created', $data['created']);
		$this->db->set('updated', $data['updated']);
		$this->db->insert('mn_master');

		return $this->db->affected_rows();
	}

	function select($id)
	{
		$this->db->where('id', $id);
		$query = $this->db->get('mn_master');

		return $query;
	}

	function selectAll()
	{
		$query = $this->db->get('mn_master');

		return $query;
	}

	function update($id, $data)
	{
		$this->db->where('id', $data['id']);
		$this->db->set('mn_id', $data['mn_id']);
		$this->db->set('mn_nm_vn', $data['mn_nm_vn']);
		$this->db->set('mn_nm_el', $data['mn_nm_el']);
		$this->db->set('mn_nm_jp', $data['mn_nm_jp']);
		$this->db->set('prnt_id', $data['prnt_id']);
		$this->db->set('note', $data['note']);
		$this->db->set('created', $data['created']);
		$this->db->set('updated', $data['updated']);
		$this->db->update('mn_master');

		return $this->db->affected_rows();
	}

	function delete($id)
	{
		$this->db->where('id', $id);
		$this->db->delete('mn_master');

		return $this->db->affected_rows();
	}

}